//mysql  select 的demo
#include <stdio.h>
#include <stdlib.h>
#include "mysql.h"

int main(int argc,char *argv)
{
	int res = 0;

	MYSQL *mysql = mysql_init(NULL);
	if(mysql == NULL)
	{
		res = mysql_errno(mysql);
		printf("mysql init error:%d\n",res);
		return res;
	}
	
	//MYSQL *mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd,const char *db, unsigned int port, const char *unix_socket, unsigned long client_flag);
	MYSQL *con = mysql_real_connect(mysql,"127.0.0.1","root","root","mem",0,NULL,0);
	if(con == NULL)
	{
		printf("mysql connect is fail,[%s]\n",mysql_error(mysql));
		return -1;
	}
	
	printf("mysql is connect ok ...,[%p]\n",con);
	mysql_close(con);
	return 0;
}